﻿using System;

namespace UniRx.Operators
{
	// Token: 0x0200037A RID: 890
	internal class ZipLatestObserver<T> : IObserver<T>
	{
		// Token: 0x0600121E RID: 4638 RVA: 0x00052D98 File Offset: 0x00051198
		public ZipLatestObserver(object gate, IZipLatestObservable parent, int index)
		{
			this.gate = gate;
			this.parent = parent;
			this.index = index;
		}

		// Token: 0x1700010A RID: 266
		// (get) Token: 0x0600121F RID: 4639 RVA: 0x00052DB5 File Offset: 0x000511B5
		public T Value
		{
			get
			{
				return this.value;
			}
		}

		// Token: 0x06001220 RID: 4640 RVA: 0x00052DC0 File Offset: 0x000511C0
		public void OnNext(T value)
		{
			object obj = this.gate;
			lock (obj)
			{
				this.value = value;
				this.parent.Publish(this.index);
			}
		}

		// Token: 0x06001221 RID: 4641 RVA: 0x00052E10 File Offset: 0x00051210
		public void OnError(Exception error)
		{
			object obj = this.gate;
			lock (obj)
			{
				this.parent.Fail(error);
			}
		}

		// Token: 0x06001222 RID: 4642 RVA: 0x00052E54 File Offset: 0x00051254
		public void OnCompleted()
		{
			object obj = this.gate;
			lock (obj)
			{
				this.parent.Done(this.index);
			}
		}

		// Token: 0x04000AF1 RID: 2801
		private readonly object gate;

		// Token: 0x04000AF2 RID: 2802
		private readonly IZipLatestObservable parent;

		// Token: 0x04000AF3 RID: 2803
		private readonly int index;

		// Token: 0x04000AF4 RID: 2804
		private T value;
	}
}
